/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.List;

/**
 * <p>Project: jse2303 - Stream1</p>
 * <p>Powered by webrx On 2023-07-25 14:09:22</p>
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream1 {
    public static void main(String[] args) {
        List<Integer> list = List.of(1, 20, 3, 18, 6, 9, 4, 25);

        for (int i : list) {
            System.out.println(i);
        }

        System.out.println("---------------------------");
        //串行流 list 转换为串行流
        list.stream().forEach(System.out::println);

        System.out.println("---------------------------");


        //并行流 list 转换为并行流，并输出 ForkJoinPool
        //list.parallelStream().forEach(System.out::println);

        //System.out.println(Thread.activeCount()); //2 main gc
    }
}
